package summary;

/**
 * @Author: 海琳琦
 * @Date: 2022/3/11 11:54
 * https://leetcode-cn.com/problems/complex-number-multiplication/
 */
public class Title537 {

    public static String complexNumberMultiply(String num1, String num2) {
        String[] split = num1.split("[+i]");
        String[] split1 = num2.split("[+i]");
        int r1 = Integer.valueOf(split[0]);
        int v1 = Integer.valueOf(split[1]);
        int r2 = Integer.valueOf(split1[0]);
        int v2 = Integer.valueOf(split1[1]);
        return String.format("%d+%di", r1 * r2 - v1 * v2, r1 * v2 + r2 * v1);
    }

    public static void main(String[] args) {
        String num1 = "1+-1i";
        String num2 = "0+0i";
        String s = complexNumberMultiply(num1, num2);
        System.out.println();
    }
}
